// 保存棋盘格子
import {ecs} from '../framework/assets/libs/ecs/ECS';
import {CellStatus} from "../cccomponent/enum";
import { Node } from 'cc';

// 初始化 grid
@ecs.register('GridInit')
export class GridInitComponent extends ecs.Comp {

    reset() {
    }
}

// 填充空白
@ecs.register('GridFillSpace')
export class GridFillSpaceComponent extends ecs.Comp {

    reset() {
    }
}

// 检查 grid
@ecs.register('GridCheck')
export class GridCheckComponent extends ecs.Comp {

    reset() {
    }
}

// 选中cell
@ecs.register('SelectCell')
export class SelectCellComponent extends ecs.Comp {

    reset() {
        this.selectToggle = false;
    }
    // 选中开关
    selectToggle: boolean = false;
}

// 交换 cell
@ecs.register('ExchangeCell')
export class ExchangeCellComponent extends ecs.Comp {
    reset() {
    }
    // 原来的坐标
    originX: number;
    originY: number;
}

// 更新 cell 状态
@ecs.register('UpdateCellStatus')
export class UpdateCellStatusComponent extends ecs.Comp {
    reset() {
        this.newStatus = CellStatus.common;
    }
    // 新状态
    newStatus: CellStatus;
}

// 移动格子
@ecs.register('MoveCell')
export class MoveCellComponent extends ecs.Comp {
    reset() {
    }
    // 目标 x
    x: number = 0;
    // 目标 y
    y: number = 0;
    // 延时时间
    delayTime: number = 0;
    // 动画播放时间
    playTime: number = 0;

}

// 消除格子
@ecs.register('CellDie')
export class CellDieComponent extends ecs.Comp {
    reset() {
    }
    delayTime: number;
}

// cellView 操作
@ecs.register('CellViewTurn')
export class CellViewTurnComponent extends ecs.Comp {
    reset() {
    }
}

// 动效层
@ecs.register('EffectLayerTurn')
export class EffectLayerTurnComponent extends ecs.Comp {
    reset() {
    }
    // 父节点
    parent: Node;
}

// 消除效果
@ecs.register('EffectCrush')
export class EffectCrushComponent extends ecs.Comp {
    reset() {
        this.delayTime = 0;
    }
    // 动效生成的位置
    posX: number;
    posY: number;
    // 延迟时间
    delayTime: number;
}
// 爆炸效果
// bomb crush
@ecs.register('EffectBomb')
export class EffectBombComponent extends ecs.Comp {
    reset() {
        this.delayTime = 0;
        this.isLine = false;
    }
    // 动效生成的位置
    posX: number;
    posY: number;
    // 延迟时间
    delayTime: number;
    // 行向
    isLine: boolean = false;
}

// 点击音效
@ecs.register('AudioClick')
export class AudioClickComponent extends ecs.Comp {
    reset() {
    }
}

// 交换音效
@ecs.register('AudioSwap')
export class AudioSwapComponent extends ecs.Comp {
    reset() {
    }
}

// 连续几轮匹配音效
@ecs.register('AudioMatch')
export class AudioMatchComponent extends ecs.Comp {
    reset() {
        this.step = 0;
    }
    step: number = 0;
}

// 连续消除音效
@ecs.register('AudioEliminate')
export class AudioEliminateComponent extends ecs.Comp {
    reset() {
        this.step = 0;
    }
    step: number = 0;
}
